package com.shycloud.mido.organ.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.shycloud.mido.common.core.util.R;
import com.shycloud.mido.organ.api.entity.MemberActivateEntity;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 纠错大师激活 service
 *
 * @author nianhua.jiang
 * @date 2020/6/18 14:02
 */
public interface MemberActivatedService extends IService<MemberActivateEntity> {

	/**
	 * 后台管理权限开通页面，开通纠错大师权限
	 */
	R addActivation(String udid, String memberId, int duration);

	R delayHardwareVip(String memberId, String endTime, int duration);

	R activateByDuration(String udid, String memberId, int duration, String orgId, String optId);

	R activateByCode(String udid, String code, String memberId, String orgId, String optId);

	R activateByCode(String startTime, String udid, String code, String memberId, String orgId,
			Integer optId, Integer duration);

	R generateCode(Integer duration, Integer num, String comment, Integer comboId, Integer optId,
			Integer orgId);

	/**
	 * 是否是纠错大师
	 *
	 * @param memberId
	 * @return
	 */
	R isMaster(String memberId);

	/**
	 * 获取权限开通页面已分配的激活列表
	 */
	R getAllocateActivation(Page page, String phone, String code, String orgId, String optId,
			String duration, String startDate, String endDate);

	/**
	 * 获取权限开通页面已分配的激活列表(运营商)
	 */
	R getAllocateActivationByOpt(Page page, String phone, String udid, Integer optId,
			Integer orgId);

	/**
	 * 获取所有激活码
	 */
	R getAllActivation(Page page, String phone, String code, String duration);


	/**
	 * 设定临时激活次数分配(机构)
	 */
	R setActivationCountByOrg(String orgId, String updatePerson, Map<Object, Object> durationMap);

	/**
	 * 设定临时激活次数分配(运营商)
	 */
	R setActivationCountByOptr(String optrId, Map<Object, Object> durationMap);

	/**
	 * 设定临时激活次数分配(运营商)
	 */
	R getOrgCountRecord(String optrId);

	/**
	 * 设定临时激活次数分配(运营商)
	 */
	R getStudioCountRecord(String optrId);

	/**
	 * 设定临时激活次数分配(运营商)
	 */
	R getOptrCountRecord(String optrId);

	/**
	 * app端激活纠错大师
	 *
	 * @param udid
	 * @param actvCode
	 * @param memberId
	 * @return java.lang.Boolean
	 * @author nianhua.jiang
	 * @date 2020/6/18 9:52
	 */
	R addActivationForApp(String udid, String actvCode, String memberId);

	/**
	 * 续费纠错大师
	 *
	 * @param udid
	 * @param actvCode
	 * @param memberId
	 * @return com.shycloud.mido.common.core.util.R
	 * @author nianhua.jiang
	 * @date 2020/6/18 15:32
	 */
	R prolongMaster(String udid, String actvCode, String memberId, LocalDateTime startTime);

	void prolongMasterMini(String udid, String actvCode, LocalDateTime startTime);

	boolean checkUdid(String udid);

	LocalDateTime activateByDurationMini(String udid, String busiType, String durationType,
			Integer durationTypeValue, String remark, Integer optId, Integer orgId, Integer distId, Integer specialType);

	LocalDateTime activateByDurationMiniSale(String udid, String busiType, String durationType,
			Integer durationTypeValue, String remark, Integer optId, Integer orgId, Integer distId);
}